package view.component.monster.large_monster
{
	import enums.main.UISize;
	
	import feathers.controls.Label;
	import feathers.data.ListCollection;
	
	import model.vo.monster.LMonsterItemEffectVo;
	
	import view.component.BaseListView;
	import view.render.monster.LMonsterItemListItem;
	
	
	/**
	 * 大型怪物详细-道具效果
	 * @author £iang
	 * 
	 */	
	public class LMDetailItemEffectView extends BaseListView
	{
		//-----------------------------
		// variables
		//-----------------------------
		
		/** 道具效果标题  */
		public var itemEffectTitle:Label;
		/** 备考标题  */
		public var referenceTitle:Label;
		
		//-----------------------------
		// properties
		//-----------------------------
		
		//-----------------------------
		// setter&getter
		//-----------------------------
		
		//-----------------------------
		// methods
		//-----------------------------
		
		/**
		 * 初始化函数 
		 * 
		 */		
		override protected function initialize():void
		{ 
			_itemH = UISize.LMONSTER_IE_ITEM_H * this.dpiScale;
			_listH = UISize.MAIN_H - 
				( UISize.MONSTER_TAB_AREA_H + 
					UISize.LMONSTER_DETAIL_TAB_AREA_H +
					UISize.LIST_TITLE_H) * this.dpiScale;
			_firstName = "道具";
			super.initialize();
		}
		
		override protected function initializeOther():void
		{
			itemEffectTitle = new Label();
			itemEffectTitle.text = "效果";
			itemEffectTitle.textRendererProperties.wordWrap = true;
			titleGroup.addChild( itemEffectTitle );
			
			referenceTitle = new Label();
			referenceTitle.text = "参考";
			referenceTitle.textRendererProperties.wordWrap = true;
			titleGroup.addChild( referenceTitle );
		}
		
		/**
		 * 绘制函数 
		 * 
		 */		
		override protected function draw():void
		{
			var labelY:Number = ( UISize.LIST_TITLE_H - 
				43 ) / 2 * this.dpiScale;
			var leftPadding:Number = UISize.TITLE_PADDING_LEFT * this.dpiScale;
			var firstTitleFullW:Number;
			
			firstTitle.y = labelY;
			firstTitle.x = leftPadding;
			firstTitleFullW = UISize.MAIN_W / 4;
			firstTitle.width = firstTitleFullW - leftPadding;
			
			itemEffectTitle.y = labelY;
			itemEffectTitle.x = UISize.MAIN_W / 4;
			itemEffectTitle.width  = UISize.MAIN_W * 0.15;
			
			referenceTitle.y = labelY;
			referenceTitle.x = UISize.MAIN_W * 0.4;
			referenceTitle.width  = UISize.MAIN_W * 0.6;
			
			list.y = UISize.LIST_TITLE_H * this.dpiScale;
		}
		
		/**
		 * 设置列表数据 
		 * @param dataVec 数据
		 * 
		 */		
		public function setListData( dataVec:Vector.<LMonsterItemEffectVo> ):void
		{
			var i:int;
			var len:int = dataVec.length;
			
			_listData = new ListCollection([]);
			
			for( i = 0; i < len; i++)
			{
				var item:LMonsterItemListItem = new LMonsterItemListItem();
				var tmpData:LMonsterItemEffectVo = dataVec[ i ] as LMonsterItemEffectVo;
				
				item.setData( tmpData );
				_listData.push( { item:item, itemData:tmpData } );
			}
			
			list.dataProvider = _listData;
		}
		//-----------------------------
		// events
		//-----------------------------
		
		//-----------------------------
		// dispose
		//-----------------------------
		
		/**
		 * 析构函数 
		 * 
		 */		
		protected override function disposeOther():void
		{
			disposeLabels( [
				"itemEffect", "reference"
			] );
		}
		
		//-----------------------------
		// construction
		//-----------------------------
		
		/**
		 * 构造函数
		 *
		 */
		public function LMDetailItemEffectView()
		{
			super();
		}
	}
}